package com.xiashitech.agent.instrumentation.db.updateset;

import com.xiashitech.agent.instrumentation.db.common.XSUpdateSizeContext;
import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.shaded.io.opentelemetry.api.GlobalOpenTelemetry;

public class XSUpdateSetSingletons {

    private XSUpdateSetSingletons() {}

    private static final String INSTRUMENTATION_NAME = "com.xiashitech.jdbc.updateset";

    private static final String SPAN_NAME = "xs.jdbc-updatetset-span";

    private static final Instrumenter<XSUpdateSizeContext.Request, Void> INSTRUMENTER;

    public static Instrumenter<XSUpdateSizeContext.Request, Void> instrumenter() {
        return INSTRUMENTER;
    }

    static {
        INSTRUMENTER =
                Instrumenter.<XSUpdateSizeContext.Request, Void>builder(
                                GlobalOpenTelemetry.get(),
                                INSTRUMENTATION_NAME,
                                _void -> SPAN_NAME)
                        .addAttributesExtractor(XSUpdateSetAttributesExtractor.create())
                        .buildInstrumenter();
    }
}
